//
//  DrawerViewController.m
//  SDKSample
//
//  Created by 小肥羊 on 15/9/23.
//  Copyright © 2015年 Zhu‘s Game House. All rights reserved.
//

#import "DrawerViewController.h"
#import "XFYDrawerView.h"

@interface DrawerViewController ()

@property (strong, nonatomic) XFYDrawerView *drawerView;

@end

@implementation DrawerViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    XFYBaseDrawerView *drawerView1 = [[XFYBaseDrawerView alloc] initWithFrame:CGRectMake(self.view.frame.size.width - 100, self.view.frame.size.height/2 - 50, 100, 50)];
    [drawerView1 setBackgroundColor:[UIColor groupTableViewBackgroundColor]];
    drawerView1.drawerViewType = XFYDrawerViewHorizontalDirectionType;
    UILabel *horizontalLabel = [[UILabel alloc] initWithFrame:drawerView1.bounds];
    [horizontalLabel setText:@"水平移动"];
    [horizontalLabel setTextAlignment:NSTextAlignmentCenter];
    [drawerView1 addSubview:horizontalLabel];
    [self.view addSubview:drawerView1];
    
    XFYBaseDrawerView *drawerView2 = [[XFYBaseDrawerView alloc] initWithFrame:CGRectMake(self.view.frame.size.width - 100, self.view.frame.size.height/2 , 100, 50)];
    [drawerView2 setBackgroundColor:[UIColor groupTableViewBackgroundColor]];
    drawerView2.drawerViewType = XFYDrawerViewVerticalDirectionType;
    UILabel *verticalLabel = [[UILabel alloc] initWithFrame:drawerView2.bounds];
    [verticalLabel setText:@"垂直移动"];
    [verticalLabel setTextAlignment:NSTextAlignmentCenter];
    [drawerView2 addSubview:verticalLabel];
    [self.view addSubview:drawerView2];
    
    XFYBaseDrawerView *drawerView3 = [[XFYBaseDrawerView alloc] initWithFrame:CGRectMake(self.view.frame.size.width - 100, self.view.frame.size.height/2 + 50, 100, 50)];
    [drawerView3 setBackgroundColor:[UIColor groupTableViewBackgroundColor]];
    drawerView3.drawerViewType = XFYDrawerViewAnyDirectionType;
    UILabel *anyLabel = [[UILabel alloc] initWithFrame:drawerView3.bounds];
    [anyLabel setText:@"随意移动"];
    [anyLabel setTextAlignment:NSTextAlignmentCenter];
    [drawerView3 addSubview:anyLabel];
    [self.view addSubview:drawerView3];
  
    
    UIImageView *headerImage = [[UIImageView alloc] initWithFrame:CGRectMake(self.view.frame.size.width - 30, self.view.frame.size.height/2 + 100, 30, 50)];
    [headerImage setImage:[UIImage imageNamed:@"j12"]];
    UIImageView *tailImage = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 50)];
    [tailImage setImage:[UIImage imageNamed:@"j13"]];
    self.drawerView = [[XFYDrawerView alloc] initWithHeaderView:headerImage TailView:tailImage];
    UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(clickTailImage)];
    [self.drawerView addGestureRecognizer:singleTap];
    [self.view addSubview:self.drawerView];
    [self.drawerView openView:YES];
}

- (void)clickTailImage
{
    NSLog(@"clickTailImageclickTailImageclickTailImageclickTailImageclickTailImag");
}


#pragma mark - 操作
- (IBAction)clickCenter:(UIButton *)sender {
    NSLog(@"点击了底部按钮");
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
